//
//  FTPasswordTextField.m
//  FileToolkit
//
//  Created by Duncan on 2021/2/4.
//

#import "FTPasswordTextField.h"

@implementation FTPasswordTextField

- (instancetype)init {
    self = [super init];
    if (self) {
        
        self.placeholder = @"请输入密码";
        self.keyboardType = UIKeyboardTypeASCIICapable;
        self.secureTextEntry = YES;
        self.background = [UIImage kj_imageWithColor:[UIColor whiteColor] size:CGSizeMake(1, 1)];
        
        
        [self.leftBackView addSubview:self.leftImageView];
        self.leftView = self.leftBackView;
        self.leftViewMode = UITextFieldViewModeAlways;
        
        [self addSubview:self.lineView];
        [self masonryLayout];
    }
    return self;
}

#pragma mark ------- Lazy Methods -------

- (void)masonryLayout {
    [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.leftBackView);
        make.size.mas_equalTo(kSizzleKapadate(10, 15));
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.mas_equalTo(1);
    }];
    
}

- (UIView *)leftBackView {
    if (!_leftBackView) {
        _leftBackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kFragmemtFloat(25), kFragmemtFloat(50))];
    }
    return _leftBackView;
}

- (UIImageView *)leftImageView {
    if (!_leftImageView) {
        _leftImageView = [[UIImageView alloc] initWithImage:@"login_password_icon".image];
    }
    return _leftImageView;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = k_Color_LineColor;
    }
    return _lineView;
}

@end
